#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>

using namespace std;

void handler(int signo)
{
    cout << "get a sig, number is : " << signo << endl;
}

int main()
{
    signal(2, handler);
    while (true)
    {
        std::cout << "I am activing..., pid: " << getpid() << std::endl;
        sleep(1);
    }
    return 0;
}